Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
5.0

Available as/for:
Description:
DeskDevRename.sh: Renames KDE desktop files according to a medium's Volume id
and changes their icons in case one is found on the medium

It does so by scanning /etc/mtab for a defined list of devices (links to which reside on the desktop) and, upon mount, gets the volume id from the device and simply renames the desktop files to it. On termination of the script or umounting the device, all changes made are reversed.

Install:
========
Simply copy it to some place that's in your $PATH and run it. It scans your
Desktop directory for Device files and creates ~/.kde/share/apps/DeskDevRename/devs.rc , in which you should delete all devices you don't wish to monitor (i.E., hard drives)

I recommend starting the script from your ~/.kde/Autostart directory
or via ~/.xinitrc
Moreover, it is very beneficial to get 'CD Detect&Execute'
(http://ericlathrop.com/cdde/), until it is possible to use it together
with supermount and such.

Further instructions and known issues can be found in the Bash script.
Last changelog:

0.3:
* This version has the ability to scan Autorun.inf, in order to substitute the icon of the Desktop device with an .ico file on the mounted CD
* $confDir/devs.rc may now be edited during run-time in order to add or remove devices to monitor on the fly, but it does not yet work very well.


Ratings & Comments

6 Comments

janschaefer

When mounting a CD-ROM, the script gives an error saying: sed: unkown option -- i I use SuSE 8.2 with GNU sed version 3.02.80

sgtpepper

Well, the -i switch is used to edit files with sed "in-place", that is: without having to make the changes to a temporary file and then overwriting the original with it... pretty convenient, I thought.
Since I am using GNU sed version 4.0.9 from Debian SID, I guess this feature is simply not yet supported in earlier versions. :-/

However, the more I look at it, the more it bugs me how bad the script is designed. At the current state it relies on 8 external utilities, in many cases for doing very small things that Bash is probably able to do on its own.
I just started with Bash scripting, or more or less programming in general, so there is still much to learn.

Also, I think it is a very poor idea to actually rename the Desktop files, because it leads to many problems (i.e., Icon positioning). I just found out that the script could simply manipulate or append an entry "Name=Volume Name" to the Desktop file for the same effect...
So I am looking forward to do a major re-write asap (at the weekend). bye

janschaefer

You can use Perl instead of sed, because perl can emulate sed behaviour: perl -pi -e 's/Hello/World/g' *.desktop replaces all occurrences of Hello with World in place.

janschaefer

Did you thought of implementing this as a KDE-Demon like KNemo? I think this would be the best.

SmackedFly

Works fine, nice work. Should really be integrated into KDE, any plans?

sgtpepper

...erm... well, no. :-D
Though I'm glad that you like it and that it works for you, it is still nothing more than a simple Shell script and should thus be considered a quick'n'dirty workaround, until the developers integrate this feature in a more "sophisticated" way.

However, I'll try to improve it further ( i.e., to support icons embedded in .exe and .dll using the 'icoutils' ), but mainly in order to learn Bash scripting, and hopefully Perl, while at the same time creating something useful.

Thanks for your comment!! :-)

Pling
0 Affiliates
Details
license
version 0.3
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 0

More Various KDE 1.-4. Improvements from sgtpepper:

Idea: Re-designing 'Recent Files' / URBs
sgtpepper
last update date: 21 years ago

Score 5.0

Other Various KDE 1.-4. Improvements:

Slicker Debian Package for Woody
cirrusgr
last update date: 22 years ago

Score 5.0

Konqueror/kdesktop suggestion
PovMan
last update date: 22 years ago

Score 5.0

Biiig buttons
dbojan
last update date: 20 years ago

Score 5.0

Yet Another KControl
Frans
last update date: 21 years ago

Score 5.0

Next window and next/previos window
dbojan
last update date: 20 years ago

Score 5.0

Fantasie Toolbar
katoe
last update date: 20 years ago

Score 5.0